﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="XnReader.WinRT.Chapter"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:XnReader.WinRT"
    xmlns:common="using:XnReader.WinRT.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>
        <x:String x:Key="RightTips">小说来了仅提供链接索引,不提供其链接内容.任何单位或个人如认为通过小说来了引擎所得的第三方网页中或链接的内容可能涉嫌侵犯您的合法权益,请及时向我们反馈.我们将移除该链接索引. To:xsll.service@gmail.com</x:String>
    </Page.Resources>
    <common:LayoutAwarePage.TopAppBar>
        <AppBar x:Name="barNav" Height="140" Background="#E5040404" >
            <local:Navigation x:Name="navTop" Margin="60,0,40,0" />
        </AppBar>
    </common:LayoutAwarePage.TopAppBar>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid DataContext="{Binding Chapter}" Style="{StaticResource LayoutRootStyle}">
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <ProgressRing Width="100" Height="100" x:Name="pbLoading"  Grid.Row="1" IsActive="True"></ProgressRing>
        <Frame Grid.RowSpan="2" Grid.Row="1" x:Name="ChapterContent"  Margin="0,20,10,0" IsTabStop="False"/>
        <!-- 后退按钮和页标题-->
        <Border BorderThickness="0,0,0,1"  BorderBrush="Silver" >
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="120"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
                <StackPanel Grid.Column="1" Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Left">
                    <StackPanel Orientation="Horizontal" Margin="15,10,0,0">
                        <TextBlock Text="{Binding chaptername}" Height="40" FontSize="24" FontFamily="Microsoft YaHei"></TextBlock>
                        <TextBlock Text="{Binding articlename}" Height="40"  Foreground="#FF8D8787" FontSize="18" Margin="10,0,0,0" Padding="0,5,0,0" FontFamily="Microsoft YaHei"></TextBlock>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Margin="15,0,0,0" >
                        <TextBlock Text="搜索来源:" Foreground="#FF8D8787" FontSize="14" FontFamily="Microsoft YaHei"></TextBlock>
                        <TextBlock Text="{Binding webname}" Foreground="#FF8D8787" FontSize="14" Margin="5,0,0,0" FontFamily="Microsoft YaHei" ></TextBlock>
                        <TextBlock Foreground="#008000" FontSize="12" Text="{Binding chapterlink}"  Margin="5,0,0,0" Padding="0,2,0,0" FontFamily="Microsoft YaHei"></TextBlock>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Margin="15,5,0,0">
                        <TextBlock Width="600" TextWrapping="Wrap" Text="{StaticResource RightTips}" Foreground="#FF8D8787" FontSize="12" FontFamily="Microsoft YaHei" ></TextBlock>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Margin="0,5,0,0" HorizontalAlignment="Left">
                        <HyperlinkButton x:Name="hlbLink" Visibility="Collapsed" Content="浏览原版本" Foreground="Green" FontSize="12" Click="HyperlinkButtonClick" FontFamily="Microsoft YaHei"></HyperlinkButton>
                    </StackPanel>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Grid.Column="2" VerticalAlignment="Center">
                    <Button x:Name="btnPrev" IsEnabled="False" AutomationProperties.Name="上一章" Content="" Style="{StaticResource AppBarButtonStyle}" Click="BtnPrevClick"/>
                    <Button x:Name="btnNext" IsEnabled="False" AutomationProperties.Name="下一章" Content="" Style="{StaticResource AppBarButtonStyle}" Click="BtnNextClick"/>
                    <Button x:Name="btnBookReader" AutomationProperties.Name="目录" Content="" Style="{StaticResource AppBarButtonStyle}" Click="BtnBookReaderClick"/>
                    <!--<Button x:Name="btnSetting" AutomationProperties.Name="设置" Content="" Style="{StaticResource AppBarButtonStyle}" Click="BtnSettingClick"/>-->
                </StackPanel>
            </Grid>
        </Border>
        <VisualStateManager.VisualStateGroups>

            <!-- Visual states reflect the application's view state -->
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>

                <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <!-- The back button and title have different styles when snapped -->
                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="barNav" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                        </ObjectAnimationUsingKeyFrames>
                        <!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
                        </ObjectAnimationUsingKeyFrames>-->
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</common:LayoutAwarePage>
